﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using pbvs.Models;
using pbvs.Models.DomainModels;

namespace pbvs.Services.ServiceExtensions
{
	public static class ManageServiceExtensions
	{
		public static DefaultDomainModel ToDomainModel(this Default value)
		{
			return new DefaultDomainModel
				       {
						   Id = value.Id,
						   Name = value.Name,
						   Value = value.Value
				       };
		}

		public static IEnumerable<DefaultDomainModel> ToDomainModels(this IEnumerable<Default> value)
		{
			return value.AsEnumerable().Select(n => n.ToDomainModel());
		}

		public static Default ToEntity(this DefaultDomainModel value)
		{
			return new Default
				       {
					       Id = value.Id,
					       Name = value.Name,
					       Value = value.Value
				       };
		}

		public static IEnumerable<Default> ToEntities(this IEnumerable<DefaultDomainModel> value)
		{
			return value.AsEnumerable().Select(n => n.ToEntity());
		}
	}
}